import 'package:flutter/material.dart';

///  全宽按钮，默认白色背景，居中，后期有需求再丰富
class FullCenterButton extends StatelessWidget {
  final IconData? iconName;
  final String text;
  final Color? color;
  final Color? bgColor;
  final double? fontSize;
  final double? iconSize;
  final VoidCallback? onTap;
  const FullCenterButton({
    super.key,
    this.iconName, // 图标，可选
    this.color = const Color(0xFF596b91), // 默认文本颜色，可选
    this.bgColor = Colors.white, // 默认背景颜色，可选
    this.fontSize = 16.0, // 默认字体大小，可选
    this.iconSize = 20.0, // 默认字体大小，可选
    required this.text, // 文本内容，必传
    required this.onTap, // 点击回调，，可选
  });

  @override
  Widget build(BuildContext context) {

    return InkWell(
      onTap: onTap,
      child: Container(
        height: 48,
        color: bgColor,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            iconName != null ? Icon(iconName, size: iconSize, color: color) : Container(),
            const SizedBox(width: 6,),
            Text(text, style: TextStyle(fontSize: fontSize, color: color,),),
          ],
        )
      ),
    );
  }
}
